import {reqGetSearchList} from '@/api'
const state = {
    searchlist: {}
};
const mutations = {
    GTESEARCH(state,searchlist) {
        state.searchlist = searchlist
    }
};
const actions = {
   async getSearchList({commit},params = {}) {
        // 当前这个reqGetSearchList这个函数在调用获取服务器数据至少传递一个空数组
       const result = await reqGetSearchList(params)
    //    console.log('actions执行完毕');
        if(result.code == 200) {
          
            commit('GTESEARCH',result.data)
        
        }
   }
};
const getters = {
    goodList(state) {
        return state.searchlist.goodsList || []
    },
    trademarkList(state) {
        return state.searchlist.trademarkList || []
    },
    attrsList(state) {
        return state.searchlist.attrsList || []
    },

}
export default {
    state,
    mutations,
    actions,
    getters
}